package my_sql_editor;

import java.io.IOException;
import java.io.StringBufferInputStream;
import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;

import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.jface.text.source.ISourceViewer;
import org.eclipse.jface.text.source.IVerticalRuler;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.editors.text.TextEditor;
import org.eclipse.ui.texteditor.ContentAssistAction;
import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;

public class MySqlEditor extends TextEditor {

	public static final String SQL_PARTITIONING = "__pos_partionning_sql";

	public MySqlEditor() {
		super(); 
		EditorSourceViewerConfiguration configuration = new EditorSourceViewerConfiguration(); 
		setSourceViewerConfiguration(configuration); 
		
	}
	
	@Override
	protected ISourceViewer createSourceViewer(Composite parent,
	                                           IVerticalRuler ruler, 
	                                           int styles)
	{
		Composite composite = new Composite(parent, SWT.NONE);
		FillLayout fillLayout = new FillLayout(SWT.VERTICAL);
	    fillLayout.marginHeight = 0;
	    fillLayout.marginWidth = 0;
	    fillLayout.spacing = 1;
	    
	    composite.setLayout(fillLayout);

	    
	    Label lab=new Label(composite,SWT.BORDER);
	    lab.setText("test de modification de la partie d'un texteditor");
	    /*GridData gridData = new GridData(GridData.FILL, SWT.TOP, true, false);
	    lab.setLayoutData(gridData);*/

	    return super.createSourceViewer(composite, ruler, styles);
	}



	@Override protected void createActions() { 
		super.createActions(); 
		ResourceBundle bundle = null; 
		try { 
			bundle = new PropertyResourceBundle( 
					new StringBufferInputStream( "ConthhentAssistProposal.label=Content assist\nContentAssistProposal.tooltip=Content assist\nContentAssistProposal.description=Provides Content Assistance")); 
		} catch (IOException e) { 
			e.printStackTrace(); 
		} 
			ContentAssistAction action = new ContentAssistAction(bundle, "ContentAssistProposal.", this); 
			String id = ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS; 
			action.setActionDefinitionId(id); 
			setAction("ContentAssist", action); 
			


				
			
		}
	
	



	
	
}
